#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<deque>
using namespace std;

class Solution{
    public:
    //超出范围
    string ans1(string a, string b){
        int bit_a = str2int(a);
        int bit_b = str2int(b);
        int total = bit_a + bit_b;
        
        string ret = int2str(total);
        return ret;
    }

    int str2int(string str){
        int len = str.size();
        int num = 0;
        for(int i = 0; i != len; i++){
            if(str[i] == '1'){
                num = num * 2 + 1;
            }else{
                num = num * 2 + 0;
            }
        }
        return num;
    }

    string int2str(int num){
        string ret = "";
        if(num == 0){
            return "0";
        }
        while(num > 0){
            if(num % 2 == 1){
                ret = ret + "1";
            }else{
                ret = ret + "0";
            }
            num = num / 2;
        }
        reverse(ret.begin(), ret.end());
        return ret;
    }

    string ans2(string a, string b){
        int lena = a.size(), lenb = b.size();
        int flag = 0;
        string ret = "";
        if(lena > lenb){
            string same = a.substr(lena - lenb, lenb);
            for(int i = lenb-1; i >= 0; i--){
                if(same[i] == b[i]){
                    if(flag){
                        ret = ret + "1";
                    }else{
                        ret = ret + "0";
                    }
                    if(same[i] == '1'){
                        flag = 1;
                    }else{
                        flag = 0;
                    }
                }else{
                    if(flag){
                        ret = ret + "0";
                        flag = 1;
                    }else{
                        ret = ret + "1";
                        flag = 0;
                    }
                }
            }
            for(int i = lena-lenb-1; i >= 0; i--){
                if(a[i] == '1'){
                    if(flag){
                        ret = ret + "0";
                        flag = 1;
                    }else{
                        ret = ret + "1";
                        flag = 0;
                    }
                }else{
                    if(flag){
                        ret = ret + "1";
                        flag = 0;
                    }else{
                        ret = ret + "0";
                        flag = 0;
                    }
                }
            }
            if(flag){
                ret = ret + "1";
                flag = 0;
            }
        }else{
            string same = b.substr(lenb - lena, lena);
            for(int i = lena-1; i >= 0; i--){
                if(same[i] == a[i]){
                    if(flag){
                        ret = ret + "1";
                    }else{
                        ret = ret + "0";
                    }
                    if(same[i] == '1'){
                        flag = 1;
                    }else{
                        flag = 0;
                    }
                }else{
                    if(flag){
                        ret = ret + "0";
                        flag = 1;
                    }else{
                        ret = ret + "1";
                        flag = 0;
                    }
                }
            }
            for(int i = lenb-lena-1; i >= 0; i--){
                if(b[i] == '1'){
                    if(flag){
                        ret = ret + "0";
                        flag = 1;
                    }else{
                        ret = ret + "1";
                        flag = 0;
                    }
                }else{
                    if(flag){
                        ret = ret + "1";
                        flag = 0;
                    }else{
                        ret = ret + "0";
                        flag = 0;
                    }
                }
            }
            if(flag){
                ret = ret + "1";
                flag = 0;
            }
        }
        reverse(ret.begin(), ret.end());
        return ret;
        
    }
};

void test1(){
    Solution s;
    string a = "11", b = "1";

    string ret = s.ans2(a, b);
    cout << ret << endl;
}

void test2(){
    Solution s;
    string a = "1010", b = "1011";

    string ret = s.ans2(a, b);
    cout << ret << endl;
}

void test3(){
    Solution s;
    string a = "10100000100100110110010000010101111011011001101110111111111101000000101111001110001111100001101", b = "110101001011101110001111100110001010100001101011101010000011011011001011101111001100000011011110011";

    string ret = s.ans2(a, b);
    cout << ret << endl;
}

int main(void){
    test1();
    test2();
    test3();

    return 0;
}